<template>
  <a-drawer
    title="复试破格审核"
    width=650
    placement="right"
    :closable="false"
    @close="onClose"
    :visible="abnormalityAuditVisible"
    style="height: calc(100% - 55px);overflow: auto;padding-bottom: 53px;">
    <a-form >
      <a-row :gutter="48">
        <a-col :sm="{span:12}"  :md="{span:12}">
            <a-form-item label='准考证编号'>
             <a-input placeholder="请输入..." v-model="postParams.zkzbh"/>
        </a-form-item>
        </a-col>
        <a-col :sm="{span:12}"  :md="{span:12}">
            <a-form-item label='姓名'>
             <a-input placeholder="请输入..." v-model="postParams.xm"/>
        </a-form-item>
        </a-col>
        <a-col :sm="{span:12}"  :md="{span:12}">
            <a-form-item label='科目一'>
             <a-input placeholder="请输入..." v-model="postParams.kmy"/>
        </a-form-item>
        </a-col>
        <a-col :sm="{span:12}"  :md="{span:12}">
            <a-form-item label='科目二'>
             <a-input placeholder="请输入..." v-model="postParams.kme"/>
        </a-form-item>
        </a-col>
        <a-col :sm="{span:12}"  :md="{span:12}">
            <a-form-item label='科目三'>
             <a-input placeholder="请输入..." v-model="postParams.kmsan"/>
        </a-form-item>
        </a-col>
        <a-col :sm="{span:12}"  :md="{span:12}">
            <a-form-item label='科目四'>
             <a-input placeholder="请输入..." v-model="postParams.kmsi"/>
        </a-form-item>
        </a-col>
        <a-col :sm="{span:12}"  :md="{span:12}">
            <a-form-item label='总成绩'>
             <a-input placeholder="请输入..." v-model="postParams.zcj"/>
        </a-form-item>
        </a-col>
        <a-col :sm="{span:12}"  :md="{span:12}">
            <a-form-item label='过线情况'>
            <a-select :allowClear="true" showSearch optionFilterProp="children" v-model="postParams.sznj">
                <a-select-option v-for="i in TYPE0126" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
              </a-select>
      </a-form-item>
        </a-col>
        <a-col :sm="{span:12}"  :md="{span:12}">
            <a-form-item label='院系'>
              <a-select :allowClear="true" showSearch optionFilterProp="children" v-model="postParams.ssyxm" @change="yxChange">
                    <a-select-option v-for="i in selectMenu.yx" :key="i.id" :value="i.dwh">{{ i.dwmc }}</a-select-option>
                  </a-select>
          </a-form-item>
        </a-col>
        <a-col :sm="{span:12}"  :md="{span:12}">
            <a-form-item label='专业'>
            <a-select :allowClear="true" showSearch optionFilterProp="children" v-model="postParams.sznj">
                <a-select-option v-for="i in TYPE0126" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
              </a-select>
            </a-form-item>
        </a-col>
        <a-col :sm="{span:12}"  :md="{span:12}">
            <a-form-item label='研究方向'>
            <a-select :allowClear="true" showSearch optionFilterProp="children" v-model="postParams.yjfx">
                <a-select-option v-for="i in TYPE0126" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
              </a-select>
            </a-form-item>
        </a-col>
        <a-col :sm="{span:12}"  :md="{span:12}">
            <a-form-item label='审核结果'>
            <a-select :allowClear="true" showSearch optionFilterProp="children" v-model="postParams.sznj">
                <a-select-option v-for="i in TYPE0126" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
              </a-select>
            </a-form-item>
        </a-col>
        <a-col :sm="{span:24}"  :md="{span:24}">
         <a-form-item label="申请备注">
              <a-textarea placeholder="请输入..." v-model="postParams.ssbz" :rows="4"/>
            </a-form-item>
        </a-col>
      </a-row>
    </a-form>
    <div class="drawer-bootom-button">
      <a-button style="margin-right: .8rem" @click="onClose">取消</a-button>
      <a-button @click="handleSubmit" type="primary" :loading="loading">保存</a-button>
    </div>
  </a-drawer>
</template>

<script>
// import moment from 'moment'
import { STable } from '~'
import { mapState } from 'vuex'

const formItemLayout = {
  labelCol: { span: 3 },
  wrapperCol: { span: 18 }
}

const selectArr = ['TYPE0126', 'TYPE0075', 'TYPE0125', 'TYPE0072']
export default {
  props: {
    abnormalityAuditVisible: {
      default: false
    }
  },
  components: {
    STable
  },
  data () {
    return {
      formItemLayout,
      loading: false,
      postParams: {
        hzfs: 'yx'
      },
      // 表头
      columns: [
        {
          title: '',
          dataIndex: 'column'
        },
        {
          title: '计划',
          scopedSlots: { customRender: 'plan' }
        },
        {
          title: '已分配',
          dataIndex: 'distribution'
        }
      ],
      selectMenu: {
        yx: [] // 院系
      }
    }
  },
  computed: {
    ...mapState({
      systemInfo: state => state.app.systemInfo,
      TYPE0126: state => state.app['TYPE0126'] // 年级
    })
  },
  created () {
    this.initSelectMenu()
    selectArr.forEach(v => {
      this.$store.dispatch('app/setDictionary', v)
    })
  },
  methods: {
    initSelectMenu () {
      let allRequest = [
        this.$api.base.collegeAll()
      ]
      Promise.all(allRequest).then(res => {
        this.selectMenu = {
          yx: res[0].data
        }
      })
    },
    reset () {
    },
    // 选择院系
    yxChange (code) {
    },
    // 选择招生年度
    zsndChange () {

    },
    // 关闭
    onClose () {
      this.reset()
      this.$emit('close')
    },
    // 保存
    handleSubmit () {
      this.reset()
      this.$emit('success')
    }
  }
}
</script>
